#ifndef _GRAPH_H_
#define _GRAPH_H_
/*STL includes */
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <string>
#include <climits>

/*boost includes*/
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/property_map.hpp>
#include <boost/graph/random.hpp>
#include <boost/random.hpp>
#include <boost/graph/topological_sort.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/pending/integer_range.hpp>
#include <boost/pending/indirect_cmp.hpp>
#include <boost/graph/transitive_closure.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>

/* Standard C++ includes */
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
/*MySQL Connector/C++ specific headers
#include <cppconn/driver.h>
#include <cppconn/connection.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <cppconn/metadata.h>
#include <cppconn/resultset_metadata.h>
#include <cppconn/exception.h>
#include <cppconn/warning.h>
*/

#define DBHOST "localhost"
#define USER "root"
#define PASSWORD ""
#define DATABASE "src"
#define NUMOFFSET 100
#define COLNAME 200

using namespace std;
using namespace boost;
using namespace __gnu_cxx;


// vertex property
struct VertexProp 
{
    size_t id;
    int level;
    // for interval labels
    int begin;
    int end;
    // for non-tree labels
    int x; // smallest descendant
    int y; // largest descesdant
    int z; // largest ancestor
    //tylor, path-hop labeling 
    set<int> Lin;
    set<int> Lout;
};

// edge property
struct EdgeProp {
    int id;
    // for tree or non-tree
    bool tree; // 1: tree; 0: non-tree
    bool mark; // 1: processed; 0: not yet
};

// graph
typedef adjacency_list<listS, listS, bidirectionalS, 
    VertexProp, EdgeProp> Graph;

typedef graph_traits<Graph>::vertex_descriptor Vertex;
typedef graph_traits<Graph>::edge_descriptor Edge;

typedef property_map<Graph, size_t VertexProp::*>::type  VertexIndexMap;
typedef boost::iterator_property_map<int *, VertexIndexMap, int, int&> IterMap;	

// Graph Helper
class GraphHelper {
public:
    static void genRandom( Graph& graph, int vsize, int esize );
};

#endif //_GRAPH_H_
